|
|
Redbeard wrote:
> Packages are used (I can't remember
> what language that is from...) as well as any number of different ways of
> distinguising variables from one set of files to another.
Java is one language that uses packages.
Their naming is to use a hierarchial tree of dot-separated names, and the standard
for choosing names is to start with reversed domain names. This latter way adds an
extra layer of safety against name collisions.
package org.xml.sax;
...
interface Parser {
...
}
Then in other code, one could use:
org.xml.sax.Parser thing = new org.apache.xerces.parsers.SAXParser();
or
import org.xml.sax.Parser;
import org.apache.xerces.parsers.SAXParser;
...
Parser thing = new SAXParser();
And here are the example docs I was just looking at:
http://xml.apache.org/xerces-j/apiDocs/overview-summary.html
Anyway, I find it more usefull than C++ namespaces where you have a single
top-level collection of naming shared by the entire world. Among other things, you
start to see names decorated with package naming like:
xmlSaxParser thing = new apacheXercesSAXParser();
And don't get the option of short-cutting.
--
Jon A. Cruz
http://www.geocities.com/joncruz/action.html
Post a reply to this message
|
|